package service;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import dao.OrderDetailDao;
import entity.Order;

public class OrderService {
	OrderDetailDao orderDetailDao=new OrderDetailDao();
	//根据ID返回其下全部订单
	public List<Order> getOrderById (int id)
	{
		List<Order> orders=new ArrayList<>(); 
		orders=orderDetailDao.getOrderById(id);
		return orders;
	}
	//用户ID返回该用户存在的订单
	public int getOidById(int u_id) {
		 return orderDetailDao.getOidById(u_id);
	}
	
	public List<Order> getOrdersByUidStatus(int u_id,String o_status)
	{
		List<Order> orders=new ArrayList<>(); 
		orders=orderDetailDao.getOrdersByUidStatus(u_id, o_status);
		return orders;
	}
	//根据订单号获取对应订单详情
	public Order getOrderByOrderId(int orderId){
		return orderDetailDao.getOrderByOrderId(orderId);
	}
	
	//根据用户id获取全部订单
	public List<Order> getOrdersByUidAll(int u_id) {
		List<Order> orders=new ArrayList<>(); 
		orders=orderDetailDao.getOrdersByUidAll(u_id);
		return orders;
	}
}

